clear all; close all; clc;
R = 220;
C = 33e-9;
L = 100e-6;
Ce = C/2;

W = 1/(R*Ce);
F = W/(2*pi)
%fprintf('f = %F MHz\n', F/1e6); 
T = 1/(10000*F)
t = 0:T:(15 * 1/F); 
lt = length(t);

Uc = nan(1,lt);
UR = nan(1,lt);
I = nan(1,lt);
dI = nan(1,lt);

f=10*F;
%A=0:2:(0.1);
%A = 1:1000:(1);
A = [1; 3; 5; 7; 9; 11; 13; 15; 17]; 
U = nan(length(A),lt);
SSS = nan(length(A),lt);
for n = 1:length(A)
    E = cos(2*pi*f*t*A(n));  
Uc(1)=0;
I(1)=0;
dI(1)=I(1)/Ce;
UR(1)=0;  
    for k =2:lt
    UR(k) = E(k-1)-Uc(k-1);
    I(k)=UR(k)/R-(UR(k)/(R*C))*T;
    Uc(k) = E(k-1) - I(k)*R;
    end
U(n,:)=(Uc/2);
end

SS1 = max(U(1,:));
SS2 = max(U(2,:));
SS3 = max(U(3,:));
SS4 = max(U(4,:));
SS5 = max(U(5,:));
SS6 = max(U(6,:));
SS7 = max(U(7,:));
SS8 = max(U(8,:));
SS9 = max(U(9,:));
SSSS = [SS1; SS2; SS3; SS4; SS5; SS6; SS7; SS8; SS9];
    
figure(1);
plot(F*A, [SSSS]); 